String clazzTpl({package}) => """
import 'package:$package/debug/app_debug_model.dart';

class UserState {
  List<AppDebugModel>? appDebug;

  UserState({this.appDebug});

  bool findAppDebug(AppDebugKey key) {
    bool on = false;
    appDebug?.forEach((element) {
      if (element.key == key) {
        on = element.on;
      }
    });
    return on;
  }

  void updateAppDebug(AppDebugModel model) {
    appDebug = appDebug?.map((e) {
      if (e.key == model.key) {
        return model;
      }
      return e;
    }).toList();
  }

  static UserState fromJson(dynamic json) {
    return UserState(
      appDebug: (json["appDebug"] as List)
          .map((e) => AppDebugModel.fromJson(e))
          .toList(),
    );
  }

  dynamic toJson() => {
        'appDebug': appDebug?.map((v) => v.toJson()).toList(),
      };

  static UserState initialState() {
    return UserState(
      appDebug: [
        AppDebugModel(
            key: AppDebugKey.debugBanner, title: 'DebugBanner', on: true),
        AppDebugModel(key: AppDebugKey.dev, title: '开发模式', on: false),
        AppDebugModel(key: AppDebugKey.policy, title: '隐私政策', on: true),
        AppDebugModel(key: AppDebugKey.errorLog, title: '错误日志', on: true),
      ],
    );
  }
}
""";
